package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102500755218";

	// 商户私钥，您的PKCS8格式RSA2私钥
	public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCp+eQfXXvmHnQS1/4+Mtauw0L/OaPaeuM5vcPi223VLzkt0xlpeUw2Dd5JjYwxzd3DF5GzPWgRPEagMJpqBJnmILBPkhuHd+0HLz0U2dlmvZPtNGdvRLyZ5yaQNg7IFPtVmkYIzpaLf2nyCNMzPZD/7bKnLzaVz8IW8tq/8nUeWkpt+B0LXMXnntwOAZ2PiXthSZCsnQfo1HvK29jcUd5suxIgrq4uZlZuEPxZCPEL8uHL2t6ObxkC+iw6hP2r0KCBO6V8jnoLy4c3NzUo3jeXqePtyP6TxCtZfaSjMOSOaxHG7vD8Ap+Gta++w6ycN3hqNYceDnvafU+w0zHsjrgpAgMBAAECggEAP9lYsdeB9R03aOSt4ltifV9nyUuzmxxSQpxf+tWGWnBUwDvt7crcr+lhuKttIEA+r0wpNPU6JE9KEF5xgqWb0fAxipJNuQN5jBtYjH6QxaEs8gufVxKw7fcAa2eDAfGvv6Yl7KT9tAT2nS5nd3YHA7wcQeTgUkIqnEg5l6TSDcYpqipt15imdkNn1jtHj90IgDmpsEGd3QdMkfg+ztpjx3KF6ZRNc3GZr+IJ1fzFnKZWvUVhEQEla0O1TAzzlZn2s0e4IDBxIDtxWEypz0BfC0SQ0Ti+jHyNutbnCd5gdWC2f2ElUuFD6zW3TEW4cbiyiUIoMByI1J/vnmGrmvzyqQKBgQD58FnSNWMpCJWm+1KS45SmRgtFkYbuAmQFZYDa1ap+veUCc/QWXhOVK0t2tushW5p7eEUHYRgJBv6S89S+e0l2YezJKnvkdWPyBLYIxiqdvJoMMocTOdSe6PEWfC9EkYLkTFqBUmt0lJ+p+z3NKueepO8MBmDti7yz8vApv5hbewKBgQCuGR9XsEjKE31HW6bO0xd0/JtCqamTuhYZqoqMerwPnPe9UH0KqWujW+Xtiewb1egZFmrztSsSGfYk1PFZA8FKjc1miy1rrEcp135NWdb+6nojqppf7lEGjL6InLUF9kfz6Np5z7+Rznvn1fsU62dkHjMPu0QPSJFFIu4ODffHqwKBgQDKpCs++lgGOdaTxupg+7FWyi1zXxUFvdx4X56ETn3oOnAFeBurUuUPqUWK361to0Zx2sYkwHzrPMeEP7r6IR0jpSuEwjQmu2KoI1evb3O35eUEBKdtWBLiMDzfnRn5vvxfuuQaO8exgpqdB31I7gNSpajGmBlYH1aEk3BSeOu/JwKBgHp409KlAV+efDfxopPGba7vcO1hWxjABIIDtbmDMb6uBp1X/M6+RilCIaqLptwiC0dyvMQ6g1UVjFF2t12ORbCDtqXXbJldNSabII+bjqH/IvLqNfUcOkWoRvTlgHb0PMO5389nNPWGUyXRIvMhcrc8g2EitIsn2oHPQ7YBX3hHAoGAO8SkFJu2dS/hp7GT8gksX3y+tNIbaHddJBnzi0D2yvUWjWknmpTG9TwtppOs5ygBvbxw2P7z1BDwCca/dhvsEgGsTFxCVMFuf/NSWXUZlF7AaCZ9x+Y8GLoeC1MATecM+VZXOHMId9J21ZFCvbPsajOyMXPGX+GNYmi49Dgcmi8=";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
	public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqfnkH1175h50Etf+PjLWrsNC/zmj2nrjOb3D4ttt1S85LdMZaXlMNg3eSY2MMc3dwxeRsz1oETxGoDCaagSZ5iCwT5Ibh3ftBy89FNnZZr2T7TRnb0S8mecmkDYOyBT7VZpGCM6Wi39p8gjTMz2Q/+2ypy82lc/CFvLav/J1HlpKbfgdC1zF557cDgGdj4l7YUmQrJ0H6NR7ytvY3FHebLsSIK6uLmZWbhD8WQjxC/Lhy9rejm8ZAvosOoT9q9CggTulfI56C8uHNzc1KN43l6nj7cj+k8QrWX2kozDkjmsRxu7w/AKfhrWvvsOsnDd4ajWHHg572n1PsNMx7I64KQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay_demo/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alipay_demo/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String charset = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

	/**
	 * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
	 * @param sWord 要写入日志里的文本内容
	 */
	public static void logResult(String sWord) {
		FileWriter writer = null;
		try {
			writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
			writer.write(sWord);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}

